﻿using System.Runtime.Serialization;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using PhoenixCrabV6.Engine.Images;
using PhoenixCrabV6.Engine.IO;

namespace PhoenixCrabV6.Engine.Screens
{
    [DataContract]
    public class SplashScreen : GameScreen
    {
        [DataMember] public Image Image;

        
        public override void LoadContent()
        {
            base.LoadContent();
            Image.LoadContent();

            //construct image layers
            ScreenLayer il = new ScreenLayer();
            il.LayerComponents.Add(Image);
            ScreenLayers.Add(il);
        }

        public override void UnloadContent()
        {
            base.UnloadContent();
            Image.UnloadContent();
        }

        public override void Update(GameTime gametime)
        {
            base.Update(gametime);
            Image.Update(gametime);

            //TODO Let's redo the screen transition & input
            if (Keyboard.GetState().GetPressedKeys().Length > 0 || InputManager.Instance.LeftClick() || InputManager.Instance.RightClick())
            {
                //get any key pressed
                ScreenManager.Instance.ChangeScreens("TitleScreen");
            }
                
        }
    }
}